package com.qianda.qdminiapp.service;

import com.qianda.qdminiapp.config.CompanyProperties;
import com.qianda.qdminiapp.domain.data.OrderContextData;
import com.qianda.qdminiapp.domain.dto.OrderAndPayCheckDto;
import com.qianda.qdminiapp.domain.dto.OrderAndPayDto;
import com.qianda.qdminiapp.domain.model.device.Device;
import com.qianda.qdminiapp.domain.model.device.QqdDevice;
import com.qianda.qdminiapp.domain.model.order.Order;
import com.qianda.qdminiapp.domain.model.order.QqdOrderInfo;
import com.qianda.qdminiapp.domain.model.order.QqdOrderTowel;

import java.util.Map;

/**
 * 订单支付策略
 * @ClassName OrderAndPaymentStrategy
 * @Author cw
 * @Date 2019/8/7 14:17
 * @Version 1.0
 */
public interface OrderAndPaymentStrategy {

    /*
     * 校验，判断状态
     * @Description
     * @Author cw
     * @Date 11:22 2019/8/7
     * @Param []
     * @return boolean
     **/
    boolean checkStatus(OrderAndPayDto orderAndPayDto);

    /*
     * 公共校验部分
     * @Description
     * @Author cw
     * @Date 13:08 2019/8/7
     * @Param []
     * @return java.lang.Boolean
     **/
    QqdDevice CommonCheck(Long deviceId,String imei, Long userId, CompanyProperties companyProperties);

    /*
     *  设备自检
     * @Description
     * @Author cw
     * @Date 11:22 2019/8/7
     * @Param []
     * @return java.lang.Boolean
     **/
    Boolean deviceStatusCheck(OrderAndPayDto orderAndPayDto,QqdDevice device);

    /*
     * 创建订单
     * @Description
     * @Author cw
     * @Date 11:23 2019/8/7
     * @Param []
     * @return com.qianda.qdminiapp.domain.model.order.Order
     **/
    OrderContextData createOrder(OrderAndPayDto orderAndPayDto) throws Exception;

    /*
     * 发起支付
     * @Description
     * @Author cw
     * @Date 11:23 2019/8/7
     * @Param [order]
     * @return void
     **/
    Map<String,Object> appPay(QqdOrderInfo qqdOrderInfo);

    /*
     * 出巾命令
     * @Description
     * @Author cw
     * @Date 11:23 2019/8/7
     * @Param []
     * @return void
     **/
    void startCommond(String orderId);

    /*
     * 发起退款
     * @Description
     * @Author cw
     * @Date 11:48 2019/8/9
     * @Param [order]
     * @return void
     **/
    void refundPay(QqdOrderTowel order);

}
